#include <iostream>

using namespace std;

int main()
{
    int sh, sm, eh, em;
    cin >> sh >> sm >> eh >> em;
    int ah, am;
    ah = eh - sh;
    am = em - sm;
    if ((am) < 0) {--ah; am = em - sm + 60;}
    if (am == 60) {++ah; am -= 60;}
    cout << ah << " " << am;
    return 0;
}
